<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<link rel="stylesheet" href="css/master.css" type="text/css" media="screen" charset="utf-8">
	<script src="js/jquery.js" type="text/javascript"></script>
	<script src="js/math.js" type="text/javascript"></script>
	<script type="text/javascript" src="js/shCore.js"></script> 
	<script type="text/javascript" src="js/shBrushJScript.js"></script> 
	<script type="text/javascript" src="js/shBrushCpp.js"></script> 
	<script type="text/javascript" src="js/shBrushPython.js"></script> 
	<link type="text/css" rel="stylesheet" href="css/shCoreDefault.css"/> 
	<link type="text/css" rel="stylesheet" href="css/shThemeEclipse.css"/> 
	<script type="text/javascript">SyntaxHighlighter.all();</script>
<title>windows_lib</title>

</head>
<body>
	<div id="header">
		<h1 id="heading">Memory Snippets</h1>
		<div id="sitenav">
			<ul>
				<li><a href="index.html">Home</a></li>
				<li><a href="index.html">Blog</a></li>
				<li><a href="index.html">Wiki</a></li>
				<li><a href="index.html">About</a></li>
			</ul>
		</div>	
	</div>
	<div id="content">
<div id="page">
<h2 id="toc_0.1">Windows 中的库</h2>


<h3 id="toc_0.1.1">利用DLL文件导出Lib</h3>

<p>
Windows API DLL导出Lib文件，供VC隐式调用DLL所用。
</p>

<p>
Visual C++ 开发工具提供了两个命令行工具，一个是dumpbin.exe,另一个是lib.exe。利用这两个工具即可从dll导出其对应的lib。
</p>

<ol>
<li>
在命令行执行：
</li>
</ol>
<p>
<code>dumpbin /exports yourdll.dll &gt; yourdll.def</code>
</p>

<ol>
<li>
编辑 yourdll.def 文件，使之格式与.def文件格式一致。比如：
<pre>
EXPORTS;
       fn1;
       fn2;
</pre>
</li>
<li>
在命令行执行：
<pre>
lib /def:yourdll.def /machine:i386 /out:yourdll.lib
</pre>
</li>
</ol>
<p>
静态库
</p>
	</div>
	</div>
	<div class="clear"></div>
	<div id="footer">
		© Copyright 2011 @liyiqiang. All Rights Reserved.
	</div>
</body>
</html>
